package com.itheima.reggie.common;

public class UserHolder {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();


    /**
     * 设置值
     * @param id
     */
    public static void setUserId(Long id){
        threadLocal.set(id);
    }

    /**
     * 获取值
     * @return
     */
    public static Long getUserId(){
        return threadLocal.get();
    }

    /**
     * 释放数据
     * @author Mosetian
     * @date 2022-9-16 9:41
     * @param
     */
    public static void release(){
        threadLocal.remove();
    }
}
